/*
 * @Description: 批量注册全局组件(项目中用了unplugin-vue-components/vite插件，此文件未使用)
 * @Author: wlj
 * @Date: 2022-12-26 10:19:25
 * @LastEditors: wlj
 * @LastEditTime: 2023-01-03 18:37:57
 * @FilePath: \my-vite-app\src\components\index.ts
 */
import { defineAsyncComponent } from "vue";

const modules: any = import.meta.glob("./global/*.vue"); // 异步方式
export default function install(app: any) {
  for (const [key, value] of Object.entries(modules) as any) {
    const name = key.slice(key.lastIndexOf("/") + 1, key.lastIndexOf("."));
    app.component(name, defineAsyncComponent(value));
  }
}
